<template>
  <div class="newAddress">
    <van-nav-bar
        title="新建收货地址"
        left-text="关闭"
        left-arrow
        @click-left="onClickLeft"
    />
    <div>
      <van-address-edit
          :area-list="areaList"
          show-search-result
          :search-result="searchResult"
          :area-columns-placeholder="['请选择', '请选择', '请选择']"
          @save="onSave"
          @change-detail="onChangeDetail"
      />

    </div>
  </div>
</template>
<script>
import { areaList } from '@vant/area-data';
// import {Edit} from '@element-plus/icons'
import { ref } from 'vue';
import { Toast } from 'vant';
export default {
  components: {
    // Edit
  },
  setup() {
    const onClickLeft = () => history.back();
    const searchResult = ref([]);

    const onSave = () => Toast('save');
    const onChangeDetail = (val) => {
      if (val) {
        searchResult.value = [
          {
            name: '黄龙万科中心',
            address: '杭州市西湖区',
          },
        ];
      } else {
        searchResult.value = [];
      }
    };
    return {
      onClickLeft,
      onSave,
      areaList,
      searchResult,
      onChangeDetail,
    };
  },
};

</script>
<style>

* {
  margin: 0;
  padding: 0;
}
.newAddress{
  width:100%;
  height: 100%;
  position: absolute
}
.newAddress .van-nav-bar {
  background: #f4f4f4;
}

</style>